﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ExtendBLL
{
    public class Course : LabMS.BLL.Course
    {
        public bool Exists(string strWhere, params System.Data.SqlClient.SqlParameter[] parameters)
        {
            try
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("select count(1) from Course ");
                if (!string.IsNullOrEmpty(strWhere))
                {
                    sb.Append(" where ");
                    sb.Append(strWhere);
                }

                return Maticsoft.DBUtility.DbHelperSQL.Exists(sb.ToString(), parameters);
            } 
            catch
            {
                return false;
            }
        }

        /// <summary>
        /// 根据课程号删除专业课程里面的相关数据
        /// </summary>
        /// <param name="Cou_ID"></param>
        /// <returns></returns>
        public bool DeleteProCourseByCouseID(int Cou_ID)
        {
            string str = "delete from ProCourse where Cou_ID=" + Cou_ID;
            int count=Maticsoft.DBUtility.DbHelperSQL.ExecuteSql(str);
            if (count > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// 获得记录条数
        /// </summary>
        /// <param name="Cou_ID"></param>
        /// <returns></returns>
        public int GetListCount(int Cou_ID)
        {
            string str = "Cou_ID="+Cou_ID;
            LabMS.BLL.ProCourse bProCourse = new LabMS.BLL.ProCourse();
            List<LabMS.Model.ProCourse> list = new List<LabMS.Model.ProCourse>();
            list=bProCourse.GetModelList(str);
            return list.Count;
        }
    }
}
